﻿using Assets.Script.Human.Player;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AtkPosTool : MonoBehaviour
{

    public bool Forward,Backward,Left,Right,Root;
    void Awake()
    {
        FindBody(transform);
        Destroy(this);
    }

    void FindBody(Transform transform)
    {
        var b = transform.GetComponent<PlayerBody>();
        if (b!=null)
        {
            if (Forward)
            {
                b.fire_forward = this.transform;
            }
            if (Backward)
            {
                b.fire_back = this.transform; 
            }
            if (Left)
            {
                b.fire_left = this.transform;
            }
            if (Right)
            {
                b.fire_right = this.transform;
            }
            if (Root)
            {
                b.fire_root = this.transform;
            }
        }
        else
        {
            FindBody(transform.parent);
        }
    }
}
